package com.ithappy.oop;
/*
* 测试Object方法
* */

public class TestObject extends Object{
    String name;
    String password;
   @Override
    public String toString() {
       System.out.println();
       System.out.println("TestObject.toString");
        return "账户名"+name+"密码"+password;
    }
    public static void main(String[] args) {
            TestObject t = new TestObject();
            System.out.println(t.toString());   //输出com.ithappy.oop.TestObject@6acbcfc0
            TestObject t2 = new TestObject();
            System.out.println(t2.toString());  //输出com.ithappy.oop.TestObject@5f184fc6
            System.out.println(t2);  //默认调用tostring()方法，输出com.ithappy.oop.TestObject@5f184fc6
    }
}

